<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .top {
            display: flex;
            background-color: rgb(0, 0, 0, 0.1);
            width: 100%;
            height: 80px;
            justify-content: center;
        }

        .top>ul {
            display: flex;
            list-style: none;
            color: rgba(0, 0, 0, 0.6);
            line-height: 40px;
        }

        .top>ul>li {
            font-size: 22px;
            margin-left: 20px;
            font-weight: 600;
            cursor: pointer;
        }

        .top>ul>li:hover {
            text-shadow: 0px 0px 5px rgba(0, 98, 255, 0.5);
        }

        .top>img {
            width: 400px;
            height: 80px;
            margin-left: -30px;
        }

        .eat {
            color: rgb(0, 0, 0, 0.4);
            margin-left: 180px;
        }

        .eat>span {
            margin-left: 8px;
            cursor: pointer;
        }

        .atw {
            width: 100%;
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .atw_a {
            border: 1px solid black;
            width: 1200px;
            height: 480px;
            padding: 80px;
        }

        .atw_a>div {
            display: flex;
        }

        .atw_a>div>h1>a {
            color: rgba(4, 0, 255, 0.6);
        }

        .atw_b>div {
            margin-left: 830px;
            margin-top: 40px;
        }

        .atw_b>div>div {
            display: inline-block;
        }

        .atw_b>div>span {
            color: rgba(0, 76, 255, 0.6);

        }

        .bos {
            background-color: black;
            position: relative;

        }

        input {
            width: 300px;
            height: 40px;
            margin-bottom: 20px;
        }

        .kawei {
            position: absolute;
            top: 10px;
            left: 400px;
        }

        .dl {
            position: absolute;
            top: 10px;
            left: 400px;
        }

        button {
            width: 80px;
            height: 60px;
            color: white;
            background-color: rgba(0, 76, 255, 0.6);
        }
    </style>
    <script src="../ajax/jquery-3.4.1.min.js"></script>
</head>

<body>
    <div class="top">
        <img src="../ajax/yi.jpg" alt="">
        <ul>
            <li>首页</li>
            <li>医院概况</li>
            <li>医院新闻</li>
            <li>科室介绍</li>
            <li>专家介绍</li>
            <li>医学教育</li>
            <li>科学研究</li>
            <li>患者服务</li>
            <li>加入我们</li>
            <li>分院区</li>
        </ul>
    </div>
    <div class="eat">
        <span class="wab">您所在的位置：</span>
        <span class="wab">首页 >></span>
        <span class="wab">公众入口 >></span>
        <span class="wab">登录</span>
    </div>
    <div class="atw">
        <div class="atw_a">
            <div class="atw_b">
                <h1>
                    <a href="" onclick="b()">用户登录</a>
                </h1>
                <div>
                    <div>还没有帐号？去</div>
                    <span class="zuce" onclick="a()">注册</span>
                </div>
            </div>
            <div class="bos">
                <div class="kawei">
                    <input type="text" placeholder="请输入用户名" id="username"><br>
                    <input type="text" placeholder="请输入性别" id="sex"><br>
                    <input type="text" placeholder="请输入身份证号" id="idCode"><br>
                    <input type="text" placeholder="请输入手机号" id="phone"><br>
                    <input type="password" placeholder="请输入密码" id="password"><br>
                    <input type="text" placeholder="请输入邮箱" id="email"><br>
                    <button id="zc">注册</button>
                </div>
                <div class="dl">
                    <input type="text" placeholder="请输入手机号" id="Ephone"><br>
                    <input type="password" placeholder="请输入密码" id="Epassword"><br>
                    <button id="dl">登录</button>
                </div>
                
            </div>
        </div>
    </div>
    <script>
        var kawei = document.getElementsByClassName("kawei")[0];
        var dl = document.getElementsByClassName("dl")[0];
        
        (function () {
            dl.hidden = false;
            kawei.hidden = true;
        }())
        function a() {
            dl.hidden = true;
            kawei.hidden = false;
        }
        function b() {
            dl.hidden = false;
            kawei.hidden = true;
        }
        $("#zc").click(function () {
            $.ajax({
                url: "http://172.16.106.87:8080/UserEnroll",
                type: "get",
                data: {
                    username: $("#username").val(),
                    sex: $("#sex").val(),
                    idCode: $("#idCode").val(),
                    phone: $("#phone").val(),
                    password: $("#password").val(),
                    email: $("#email").val()

                },
                success: function (awm) {
                console.log(awm);
                
                    alert(awm)
                }
            })
        })
        $("#dl").click(function () {
            $.ajax({
                url: "http://172.16.106.87:8080/login",
                type: "get",
                data: {
                    phone: $("#Ephone").val(),
                    password: $("#Epassword").val()
                },
                success: function (sout) {
                    if(sout.code==200){
                        alert("登录成功");
                        localStorage.setItem("userlist",JSON.stringify(sout))
                    }else{
                        alert("登录失败")
                    }
                }
            })
        })
        
    </script>
</body>

</html>